class Place < Core
  has_one :core, :as => :resource
  belongs_to :location
  
  has_many :events, :dependent => :destroy

  
  default_value_for :is_generic, false
  default_value_for :colors, "666666"
  
  validates_presence_of :location
  
  def location_attributes=(loc)    
    self.location = Location.set_location(loc)
  end  
  
  def images_view
    a = []
    a << { :big => get_avatar(:thumb_big), :original => get_avatar(:original) }
    for i in events 
      a << { :big => i.get_avatar(:thumb_big), :original => i.get_avatar(:original) } if i.image
    end
    return a
  end
end
